<template>
  <div class="appMiHome">
    <van-nav-bar
    title="选择城市"
    left-arrow
    @click-left="$router.go(-1)"
    />
    <van-index-bar class="indexbar">
      <div v-for="(item, index) in list" :key="index">
        <van-index-anchor :index="item.letter.toUpperCase()" />
        <van-cell :title="item1.name" v-for="(item1, index1) in item.data" :key="index1"/>
      </div>
    </van-index-bar>
  </div>
</template>
<script>
import Vue from 'vue'
import { IndexBar, IndexAnchor, NavBar, Cell } from 'vant'
import { getCityListApi } from '@/api/mock'

Vue.use(IndexBar)
Vue.use(IndexAnchor)
Vue.use(NavBar)
Vue.use(Cell)
export default {
  name: 'AppMiHome',
  data () {
    return {
      list: []
    }
  },
  methods: {
    async GetCityList () {
      try {
        const list = await getCityListApi()
        this.list = list
        console.log(this.list)
      } catch (error) {}
    }
  },
  mounted () {
    this.GetCityList()
  }
}
</script>
<style lang="scss" scoped>
.appMiHome {
  // ..
}
</style>
